package com.lcy.eb.controller;

import com.lcy.eb.model.EbProduct;
import com.lcy.eb.service.ProductService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("product")
public class productController {
    @Resource
    private ProductService productService;

    @RequestMapping("detail")
    public String detail(Model model, int pid){
        System.out.println("进入productController的detail方法"+pid);
        EbProduct ebProduct = productService.detail(pid);
        model.addAttribute("productDetail",ebProduct);
        return "product-view";
    }

    @RequestMapping("add_car")
    public String addCar(int epId, HttpServletRequest request){
        productService.addCar(epId,request);
        return "shopping";
    }

    @RequestMapping("pay")
    public String pay(){
        return "shopping-result";
    }

}
